package com.hu.zhcc.shiro.service.dingming;

import com.hu.zhcc.common.entity.Page;
import com.hu.zhcc.common.entity.PageRequest;
import com.hu.zhcc.shiro.dao.dingming.TOrderInfoMapper;
import com.hu.zhcc.shiro.dao.dingming.TOrderMapper;
import com.hu.zhcc.shiro.entity.dingming.TOrderInfo;
import com.hu.zhcc.shiro.entity.dingming.TOrderInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class TOrderInfoServiceImpl implements TOrderInfoService{
    @Autowired
    private TOrderInfoMapper tOrderInfoMapper;
    
    @Override
    public int deleteByPrimaryKey(Integer id) {
        return tOrderInfoMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(TOrderInfo record) {
        return tOrderInfoMapper.insert(record);
    }

    @Override
    public int insertSelective(TOrderInfo record) {
        return tOrderInfoMapper.insertSelective(record);
    }

    @Override
    public TOrderInfo selectByPrimaryKey(Integer id) {
        return tOrderInfoMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(TOrderInfo record) {
        return tOrderInfoMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(TOrderInfo record) {
        return tOrderInfoMapper.updateByPrimaryKey(record);
    }

    @Override
    public Page<TOrderInfo> listTOrderInfo(Map<String, Object> parameters, int offset, int limit) {
        int total = tOrderInfoMapper.countTOrderInfo(parameters);
        List<TOrderInfo> tOrderList = null;
        if (total > 0) {
            PageRequest pageRequest = new PageRequest(offset, limit, parameters);
            tOrderList = tOrderInfoMapper.listTOrderInfo(pageRequest);
        }
        return new Page<TOrderInfo>(total, tOrderList);
    }
}
